<?php

final class GerenciaPrivilegio{
	private $resultPrivilegio;
	private $sqlPrivilegio;
	private $parametro;
	private $conexao;
	
	public function __construct(ConectaMysql $conexao){		
		$this->conexao = $conexao;
	}
	
	
	
	function selectPrivilegio($parametro = null){
		
		$this->sqlPrivilegio = "SELECT * FROM tb_privilegio WHERE PRIVstatus = '1'";
		
		if (isset($parametro)){
			$this->parametro = addslashes($parametro);
			
			$this->sqlPrivilegio = $this->sqlPrivilegio." AND (tb_privilegio.PRIVid = '".$this->parametro."')";	
				
		}
		$this->sqlPrivilegio= $this->sqlPrivilegio." ORDER BY PRIVdescricao";
		$this->resultPrivilegio = $this->conexao->executaQuery($this->sqlPrivilegio);	
		return $this->resultPrivilegio;
	}

}
	
?>